local hx__wuxing = fk.CreateSkill {

  name = "hx__wuxing",

  tags = {  },

}



hx__wuxing:addEffect(fk.DrawNCards, {
  name = "hx__wuxing",
  anim_type = "drawcard",
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(hx__wuxing.name) and target and target == player and player:getMark("@hx__jianqi") > 0 and data.n > 0
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local num = player:getMark("@hx__jianqi")
    player:drawCards(num,hx__wuxing.name,"top",{"@hx__wuxing_cards-inarea",Player.Hand})
    if player:usedSkillTimes("hx__tuiying",Player.HistoryGame) ~= 0 then
      data.n = 0
      return true
    end
  end,
})
hx__wuxing:addEffect(fk.PreHpRecover, {
  can_refresh = function (self, event, target, player, data)
    return
        target == player and
        player:hasSkill(hx__wuxing.name) and
        data.card and
        data.card.trueName == "peach" and
        data.recoverBy and
        data.recoverBy == player and
        player.hp <= 1
  end,
  on_refresh = function (self, event, target, player, data)
    data.num = data.num + 1
  end,
})

hx__wuxing:addEffect("maxcards", {
  name = "#hx__wuxing_maxcard",
  exclude_from = function (self, player, card)
    return player:hasSkill("hx__wuxing") and card:getMark("@hx__wuxing_cards-inarea") ~= 0
  end,
})

hx__wuxing:addEffect("prohibit", {
  name = "#hx__wuxing_prohibit",
  is_prohibited = function (self, from, to, card)
    return to:hasSkill("hx__wuxing") and to.hp <= 2 and card.sub_type == Card.SubtypeDelayedTrick
  end,
})

return hx__wuxing